package com.example.mobile2030606148tdh0615hw;

import androidx.appcompat.app.AppCompatActivity;

import android.content.ContentValues;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;

public class MainActivity extends AppCompatActivity {
    MySQLiteOpenHelper openHelper;
    SQLiteDatabase database;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        openHelper=new MySQLiteOpenHelper(this,"SmartTraffic.db",null,1);
        ContentValues values=new ContentValues();
        values.put("carnumber","1");
        values.put("pcode", "2");
        values.put("pdatetime", "3");
        values.put("paddr", "4");
        database = openHelper.getWritableDatabase();
        long result = database.insert("CarPeccancy", null, values);
        database.close();
        ContentValues values2 = new ContentValues();
        values2.put("Co2", "1");
        values2.put("Pm25", "2");
        values2.put("LightIntensity", "3");
        values2.put("humidity", "4");
        values2.put("temperature", "5");
        database = openHelper.getWritableDatabase();
        long result2 = database.insert("Sense", null, values2);
        database.close();
        ContentValues values3 = new ContentValues();
        values3.put("carnumber", "1");
        values3.put("number", "2");
        values3.put("pcardid", "3");
        values3.put("buydata", "4");
        values3.put("carbrand", "5");
        database = openHelper.getWritableDatabase();
        long result3 = database.insert("CarInfor", null, values3);
        database.close();
    }
}